//package com.zmn.plat.task.job.price;
//
//import com.github.ltsopensource.core.domain.Action;
//import com.github.ltsopensource.core.domain.Job;
//import com.github.ltsopensource.spring.tasktracker.JobRunnerItem;
//import com.github.ltsopensource.spring.tasktracker.LTS;
//import com.github.ltsopensource.tasktracker.Result;
//import com.zmn.common.constant.GlobalConsts;
//import com.zmn.common.dto.ResultDTO;
//import com.zmn.manager.lts.interfaces.task.TaskManager;
//import com.zmn.plat.business.interfaces.price.CommonBService;
//import com.zmn.plat.common.constant.ProductConsts;
//import com.zmn.plat.manager.dictionary.ProductDict;
//import com.zmn.plat.manager.utils.TaskConsts;
//import com.zmn.plat.model.entity.product.ServProduct;
//import com.zmn.plat.model.entity.product.ServProductQuery;
//import com.zmn.plat.model.entity.service.tariff.ServiceTariff;
//import com.zmn.plat.services.interfaces.product.ServProductService;
//import com.zmn.plat.services.interfaces.service.tariff.ServiceTariffService;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import sun.swing.BakedArrayList;
//
//import javax.annotation.PostConstruct;
//import javax.annotation.Resource;
//import java.util.ArrayList;
//import java.util.Arrays;
//import java.util.List;
//import java.util.concurrent.TimeUnit;
//
///**
// * 描述: 基本信息任务（产品、价格表、渠道等）
// *
// * @author guoqiao
// * @since 2021/9/23 18:42
// */
//@LTS
//public class BaseJob {
//    private Logger logger = LoggerFactory.getLogger(this.getClass());
//
//    @Resource
//    TaskManager taskManager;
//    @Resource
//    RedisTemplate<String, String> redisTemplate;
//    @Resource
//    ServProductService servProductService;
//
//    @PostConstruct
//    void init() {
//        Job productJob = new Job();
//        productJob.setTaskId(TaskConsts.TASK_ID_PRODUCT_BASE);
//        productJob.setParam(TaskManager.SHARD_FIELD, TaskConsts.TASK_ID_PRODUCT_BASE);
//        productJob.setCronExpression("0 0 0/1 * * ?");
//        productJob.setReplaceOnExist(true);
//        ResultDTO checkTariffResult = taskManager.submitTask(productJob);
//        if (checkTariffResult.getStatusBool()) {
//            logger.info("提交查询产品基本信息成功......");
//        }
//
//    }
//
//    /**
//     * 描述: 查询产品基本信息
//     *
//     * @author guoqiao
//     * @since 2021/9/23 18:46
//     */
//    @JobRunnerItem(shardValue = TaskConsts.TASK_ID_PRODUCT_BASE)
//    public Result runProductJob(Job job) {
//        try {
//            logger.info("查询产品基本信息任务执行开始了");
//            List<Integer> ids = servProductService.listAllIds();
//            for (Integer id : ids) {
//                String key = String.format("plat:redis1h:service:product:key:%s", id);
//                redisTemplate.delete(key);
//                servProductService.findByKeyWithCache(id);
//            }
//            logger.info("查询产品基本信息任务执行成功了");
//            return new Result(Action.EXECUTE_SUCCESS, "查询产品基本信息任务执行成功了!");
//        } catch (Exception e) {
//            logger.error("查询产品基本信息任务执行失败了,MSG:{}", e.getMessage(), e);
//            return new Result(Action.EXECUTE_FAILED, "查询产品基本信息任务执行失败了");
//        }
//    }
//
//
//}
